<?php
function getModel($subbagian, $db){
	global $subbagianConfig;
	
	if( in_array($subbagian, $subbagianConfig) ){
		$modelName  = camelCase($subbagian).'Model';
		include 'library/model/'.$subbagian.'.php';
		return new $modelName($db);
	}
	else{
		die('Subbagian doesnt exists (model.php)');
	}
}

function camelCase($str){
	$str	= str_replace('_', ' ', $str);
	$str	= ucwords($str);
	$str	= str_replace(' ', '', $str);

	return $str;
}

?>